<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery-3.7.1.min.js"></script>
</head>
<body>
    <div id="div1">
        <span>我是一个div</span>
        <br>
        <input type="text"  id = "text1" value="password">
        <input type="button" id="updateContent" value="点击修改">
        <p><a href="https://www.baidu.com" id = "baidu">百度</a></p>
        <img src="../HTML练习/pic/0040jbadgy1gnbm1jf7a4j62bp340x6q02.jpg" id="kiku" width="200px"> 
    </div>
    <script>
        let content = $("#div1").text();
        console.log(content);
        
        let content2 = $("#div1").html();
        console.log(content2);

        let content3 = $("#text1").val();
        console.log(content3);

       
        $("#updateContent").click(function(){
             $("span").text("我是修改后的内容");
            //$("#div1").html("<h1>我是修改后的内容</h1>")
            $("#text1").val("update password");
        })

        //获取属性
        let href = $("p a").attr("href");
        console.log(href);
        $("#updateContent").click(function(){
            $("p a").attr("href","https://www.jd.com/");
             console.log($("p a").attr("href"));
            $("p a").text("京东");
        })

        let width = $("#kiku").attr("width");
        console.log(width);
        $("#updateContent").click(function(){
            $("#kiku").attr("width","400px");
            console.log($("#kiku").attr("width"));
        })

    </script>
</body>
</html>